//
//  UIView+Util.h
//  FreeTravel
//
//  Created by 刘志达 on 16/1/13.
//  Copyright © 2016年 刘志达(沈阳). All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIView (Util)

@property (nonatomic,assign) CGFloat x;
@property (nonatomic,assign) CGFloat y;
@property (nonatomic) CGFloat left;        ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat top;         ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat right;       ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic) CGFloat bottom;      ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic) CGFloat width;       ///< Shortcut for frame.size.width.
@property (nonatomic) CGFloat height;      ///< Shortcut for frame.size.height.
@property (nonatomic) CGFloat centerX;     ///< Shortcut for center.x
@property (nonatomic) CGFloat centerY;     ///< Shortcut for center.y
@property (nonatomic) CGPoint origin;      ///< Shortcut for frame.origin.
@property (nonatomic) CGSize  size;        ///< Shortcut for frame.size.

- (UIColor *)colorOfPoint:(CGPoint)point;

- (void)setCornerRadius:(CGFloat)cornerRadius;

- (void)setCornerRadiusWithTop:(CGFloat)cornerRadius;

- (void)setBorderWidth:(CGFloat)width borderColor:(UIColor *)color;

/**
 *  仅设置圆角
 *
 *  @param radius 圆角半径
 */
- (void)addCorner:(CGFloat)radius;
/**
 *  设置圆角
 *
 *  @param radius          圆角半径
 *  @param borderWidth     边框宽度
 *  @param backgroundColor 视图背景颜色
 *  @param borderColor     边框颜色
 */
- (void)addCorner:(CGFloat)radius borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor borderColor:(UIColor *)borderColor;

@end

@interface UIImageView (Util)

// 设置图片等比例显示
- (void)setAspectScale;

// 图片圆角
- (void)img_addCorner:(CGFloat)radius;

@end



@interface UIImage (Util)

//视频图片添加播放箭头
+ (UIImage *)getVadioImage:(UIImage *)image;

//合并两张图片
+ (UIImage *)addImage:(UIImage *)image1 withImage:(UIImage *)image2;

//修改图片透明度
+ (UIImage *)imageByApplyingAlpha:(CGFloat )alpha  image:(UIImage*)image;

// 改变图片颜色
- (UIImage *)imageWithColor:(UIColor *)color;

// 设置图片圆角
- (UIImage*)imageAddCornerWithRadius:(CGFloat)radius andSize:(CGSize)size;

- (void)setCorImage:(CGFloat)cor;

/**
 *  获取视频的缩略图方法
 *
 *  @param fileurl 视频的链接地址
 *
 *  @return 视频截图
 */
+ (UIImage *)getImageFromVideoURLString:(NSString *)fileurl;

/**
 *  获取视频的缩略图方法
 *
 *  @param url 视频的链接地址
 *
 *  @return 视频截图
 */
+ (UIImage *)getImageFromVideoURL:(NSURL *)url;

/**
 *  获取视频详情
 *
 *  @param fileurl 视频的链接地址
 *
 *
 */
+ (void)getImageFromVideoURLString:(NSString *)fileurl handle:(void (^)(NSDictionary *))handle;

+ (UIImage *) imageWithFrame:(CGRect)frame alphe:(CGFloat)alphe color:(UIColor *)color;

/**
 *  生成二维码方法
 *
 *  @param string 生成字符串
 *  @param Imagesize 视频的链接地址
 *  @param waterImagesize logo大小
 *  @param logoImage logo
 *
 *  @return 视频截图
 */
+ (UIImage *)qrImageForString:(NSString *)string imageSize:(CGFloat)Imagesize logoImageSize:(CGFloat)waterImagesize logoImage:(UIImage *)logoImage;

@end

@interface UIButton (UIButtonExt)

- (void)verticalImageAndTitle:(CGFloat)spacing;

@end
